<?php

class ComercialController extends Controller {
    /**
     * @final   pacote das views deste controller
     */
    const PACKAGE_VIEW = 'comercial';

    /**
     * @var PlanoService
     */
    private $planoService;
    /**
     * @var AtendimentoService
     */
    private $atendimentoService;

    public function __construct() {
        $this->planoService = PlanoService::getInstance();
        $this->atendimentoService = AtendimentoService::getInstance();
        $this->comercialService = ComercialService::getInstance();
    }

    /**
     * @method  cadastrarCliente
     *
     * Chama a view de cadastro de cliente
     *
     * @author  Richard Brandao
     * @since   Marco de 2012
     */
    public function cadastrarCliente() {
        $this->save(SESSION_INTERFACE, 'PlanList', $this->planoService->findEnabledPlans());
        $this->view('cadastrar_cliente', self::PACKAGE_VIEW);
    }

    public function cancelamento(){
        $ArCancelledCalled = $this->atendimentoService->findAllCancelledCalled();
        $this->save(SESSION_INTERFACE, 'CalledList', $ArCancelledCalled);
        $this->view('cancelamento', self::PACKAGE_VIEW);
    }

    public function relatorioInscricao() {
        $this->save(SESSION_INTERFACE, 'SubscriptionReport', $this->comercialService->generateSubscriptionReport());
        $this->view('relatorio_inscricao', self::PACKAGE_VIEW);
    }

    public function relatorioCancelamento() {
        $this->save(SESSION_INTERFACE, 'CancelledReport', $this->comercialService->generateCancelledReport());
        $this->view('relatorio_cancelamento', self::PACKAGE_VIEW);
    }

}

?>
